package com.taijihuabao.modules.enums.optenums.approval;


/**
 * @author wang
 */
public enum BusinessEnum {

    /**
     * 请假审批
     */
    LEAVE("leaveApproval", "请假"),
    /**
     * 离职审批
     */
    QUIT("quit", "离职"),
    /**
     * 报销审批
     */
    CHAIM("EXPENSE", "报销"),
    /**
     * 提薪审批
     */
    RAISESALARY("RaiseSalary", "提薪"),
    /**
     * 补卡审批
     */
    Re_Card("checkReissue", "补卡");

    /**
     * 编码
     */
    private final String code;
    /**
     * 信息
     */
    private final String message;

    BusinessEnum(String code, String message) {
        this.code = code;
        this.message = message;
    }

    /**
     * 根据状态code获取枚举名称
     *
     * @return
     */
    public static String getMessageByCode(String code) {
        for (BusinessEnum status : BusinessEnum.values()) {
            if (status.getCode().equals(code)) {
                return status.message;
            }
        }
        return null;
    }

    /**
     * 根据枚举名称获取状态code
     *
     * @return
     */
    public static String getCodeByMessage(String message) {
        for (BusinessEnum status : BusinessEnum.values()) {
            if (status.getMessage().equals(message)) {
                return status.code;
            }
        }
        return null;
    }

    /**
     * 根据状态code获取枚举值
     *
     * @return
     */
    public static BusinessEnum getByCode(String code) {
        for (BusinessEnum status : BusinessEnum.values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        return null;
    }

    public String getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

}
